Add support for Model Context Protocol#120
Open
martin-fleck-at wants to merge 1 commit intomainfrom
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds Model Context Protocol (MCP) support to the GLSP server, enabling AI assistants and other MCP clients to interact with GLSP diagrams through a standardized protocol. The implementation provides HTTP-based MCP server functionality with default tools for diagram manipulation and resources for querying diagram state.
Key changes:
- Introduces new
@eclipse-glsp/server-mcppackage with MCP server infrastructure, HTTP transport layer, and default tools/resources for diagram interaction - Extends GLSP server initialization to support contributions via
GLSPServerInitContributioninterface - Updates workflow example to demonstrate MCP integration
Reviewed changes
Copilot reviewed 19 out of 21 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/server/src/common/session/client-session-manager.ts | Adds getSessions() method to retrieve all active client sessions |
| packages/server/src/common/protocol/glsp-server.ts | Introduces GLSPServerInitContribution mechanism and deprecates handleInitializeArgs |
| packages/server/src/common/di/server-module.ts | Adds binding configuration for GLSPServerInitContribution |
| packages/server-mcp/tsconfig.json | TypeScript configuration for new MCP package |
| packages/server-mcp/src/mcp-util.ts | Utility functions for MCP parameter extraction and result formatting |
| packages/server-mcp/src/mcp-server-manager.ts | Core MCP server lifecycle management and HTTP server initialization |
| packages/server-mcp/src/mcp-server-contribution.ts | Interface for extending MCP server with custom tools and resources |
| packages/server-mcp/src/index.ts | Package exports |
| packages/server-mcp/src/http-server-with-sessions.ts | HTTP server implementation with MCP session management |
| packages/server-mcp/src/di.config.ts | Dependency injection configuration for MCP module |
| packages/server-mcp/src/default-mcp-tool-contribution.ts | Default MCP tools for diagram validation, element creation, undo/redo, and save operations |
| packages/server-mcp/src/default-mcp-resource-contribution.ts | Default MCP resources for querying sessions, diagram types, element types, and models |
| packages/server-mcp/package.json | Package metadata and dependencies for MCP package |
| packages/server-mcp/.eslintrc.js | ESLint configuration ignoring MCP SDK imports |
| examples/workflow-server/tsconfig.json | Adds reference to server-mcp package |
| examples/workflow-server/src/node/app.ts | Integrates MCP module into workflow server |
| examples/workflow-server/src/common/workflow-glsp-server.ts | Migrates from deprecated handleInitializeArgs to GLSPServerInitContribution |
| examples/workflow-server/src/common/workflow-diagram-module.ts | Updates binding to use new init contribution pattern |
| examples/workflow-server/package.json | Adds dependency on server-mcp package |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
fd94922 to
05c8fc5
Compare
This was referenced Dec 19, 2025
Merged
84f5685 to
6fec69a
Compare
2 tasks
Exposes each GLSP server as an MCP server over Streamable HTTP, so LLM clients can query and mutate diagrams via MCP resources, tools, and prompts. Architecture - One MCP endpoint per GLSP server process; under per-window deployment, one endpoint per application instance. - Auto-discovers diagram-scoped contributions from all GLSP client sessions and merges them into a shared surface with cross-session ID aliasing. - Pluggable model-serializer, label-provider, and element-types extension points for diagram-specific overrides. - Opt-in: started only when configured on initialize. - Random port by default; the announced URL is surfaced for adopter discovery. - No built-in auth; loopback-only unless explicitly acknowledged. - Targets MCP spec 2025-06-18 via the official SDK. Adopters - Diagram module: register language-specific tools, prompts, resources, and override the diagram extension points. - Server module: configure server-wide options (port, route, auth acknowledgement). - The workflow server example wires both end-to-end. Server framework - Adds an initialize-contribution extension point on the default GLSP server, used by MCP to surface configuration on initialize. The previous `handleInitializeArgs` hook is deprecated — adopters subclassing the default server should migrate. Documentation - Adopter README plus a separate architecture document covering the feature matrix, lifecycle, extension points, and rationale. Misc - Small fix to a base type-guard on edges in the graph package. - Disposes the server instance when the JSON-RPC client connection closes uncleanly (browser/IDE force-close). - Action dispatcher drops stale response actions arriving without a registered handler instead of throwing. Part of eclipse-glsp/glsp#1546 Co-authored-by: Andreas Hell <44035624+Sakrafux@users.noreply.github.com>
6fec69a to
98d9088
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What it does
Exposes each GLSP server as an MCP server over Streamable HTTP, so LLM
clients can query and mutate diagrams via MCP resources, tools, and
prompts.
Architecture
deployment, one endpoint per application instance.
sessions and merges them into a shared surface with cross-session
ID aliasing.
extension points for diagram-specific overrides.
discovery.
Adopters
resources, and override the diagram extension points.
acknowledgement).
Server framework
GLSP server, used by MCP to surface configuration on initialize.
The previous
handleInitializeArgshook is deprecated — adopterssubclassing the default server should migrate.
Documentation
feature matrix, lifecycle, extension points, and rationale.
Misc
closes uncleanly (browser/IDE force-close).
registered handler instead of throwing.
Part of eclipse-glsp/glsp#1546
Requires eclipse-glsp/glsp-client#456
How to test
mcpServerconfiguration[McpServerManager] MCP server 'glspMcpServer' is ready to accept new client requests on: http://127.0.0.1:64577/glsp-mcpFollow-ups
Changelog